package com.github.phoenics.newlives.common.base;

import lombok.*;
import lombok.extern.slf4j.Slf4j;

/**
 * 返回结构体
 *
 * @author Phoenics Chow
 * on 2019年09月24日
 */
@Slf4j
@Getter
public class RestResponse {
    private int status=1;
    private String message="success";
    private Object data=null;
    private long timestamp=System.currentTimeMillis();
    private RestResponse(){}
    private RestResponse(int status,String message,Object data){
        this.status=status;
        this.message=message;
        this.data=data;
    }
    private RestResponse(Object data){
        this.data=data;
    }
    private RestResponse(int status,String message){
        this.status=status;
        this.message=message;
    }
    public static RestResponse success(Object data){
        return new RestResponse(data) ;
    }
    public static RestResponse success(){
        return new RestResponse() ;
    }
    public static RestResponse exception(int status,String message){
        return new RestResponse(status,message) ;
    }
    public static RestResponse exception(){
        return exception(-1,"fail");
    }








}
